group fetch top N RecordsOften see the problem, how to take out the first N records of each group. Convenient for everyone to refer to the common several solutions listed below.question: The table below, requires the removal of the top two classes (allow second)Table1+----+------+------+-----+| ID | SName | Clsno | score|+----+------+------+-----+| 1 |AAAA | C1 | 67 || 2 |BBBB | C1 | 55 || 3 |CCCC | C1 | 67 || 4 |DDDD | C1 | 65 || 5 |eeee | C1 | 95 || 6 |FFFF | C2 | 57 || 7 |GGGG | C2 | 87 || 8
I often see problems, how to retrieve the first N records of each group. For your convenience, I will list several common solutions.
Problem: The table is as follows. The first two names of each class must be taken out (the second name can be used together) Table1+ ---- + ------ + ----- +| ID | sname | clsno | score |+ ---- + ------ + ----- +| 1 | AAAA | C1 | 67 || 2 | BBBB | C1 | 55 || 3 | CCCC | C1 | 67 || 4 | dddd | C1 | 65 || 5 | eeee | C1 | 95 || 6 | FFFF | C2 | 57 || 7 | GGGG | C2 | 87 |
{workbook = new Hssfworkbook (new FileInputStream (file));
catch (FileNotFoundException e) {e.printstacktrace ();
catch (IOException e) {e.printstacktrace ();
}/** * Reads the data in the Excel table. * * @param sheetname * Table index (EXCEL is a multiple-table document, so you need to enter a table index number, such as Sheet1)/public list readfromexcel (String Sheetna Me, object) {List result =New ArrayList ();
Gets the class object class Class_ = Object.getclass () of the object;
distinct c_id from t_ SC SCJoin t_course C on SC. c_id = C. IDJoin t_teacher t on C. t_id = T. IDAnd T. tname = 'peiping ')
17The average score shows the "Chinese" and "Mathematics" course scores of all students in the form of student ID, Chinese, mathematics, and valid courses, valid average score
Select tttt. t_s_id,Max (Case cname when 'China' then score else' 'end) language,Max (Case cname when 'mate' then score else ''end) math,Max (cnum) valid
Tcpdump pt-query-digest common operations,
Tcpdump pt-query-digest Common OperationsTcpdump pt-query-digest
Objective:
Use the tcpdump command to capture data packets according to certain rules, and then dump them to intermediate files. Use pt-query-digest to analyze intermediate files according to certain rules.Tcpdump
Tcpdump is a powerful command. Here we only discuss some typical tcp output methods, because MySQL uses tcp (reliable) to transmit data.
[root@archpredb214 ~]#tcpdump -s 65535 -
directory""When the file itself belongs to Group G with execute permission X, and the S permission will display lowercase s in the location of x permission, and if there is no X Execute permission, it will be capitalized S"Sticky: "A directory with Write permissions typically users can delete any file in that directory, regardless of the permissions or ownership of the fileIn the directory settings sticky bit, only the file owner or root can delete the file ""Only works on the directory.""When
LOCAL SYSTEM AUTO/U02/ORACLE/ORADATA/ORCL/SYSTEM01.DBF System LOCAL system MANUAL/U02/ORACLE/ORADATA/ORCL/TEST01.DBF TEST LOCAL SYSTEM AUTO/U02/ORACLE/ORADATA/ORCL/UNDOTBS01.DBF UNDOTBS1 LOCAL SYSTEM MANUAL/U02/ORACLE/ORADATA/ORCL/USERS01.DBF USERS LOCAL SYSTEM AUTOThe following are the results of ASM:Col file_name for A40;Col Tablespace_name for A10;file_name tablespace extent_man allocatio segmen---------------------------------------- ---------- ---------- --------- ------+data/orc
The previous example is that we process and send messages in the child thread (workerthread), then get the message in the main thread (UI thread) and modify the UI, so we can not send the message from the main threads, the child thread receives it? Let's write the code according to the previous idea: Packagecn.lixyz.handlertest;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.os.Handler;ImportAndroid.os.Message;ImportAndroid.util.Log;ImportAndroid.view.View;ImportAndroid.widget.B
from the database?
Slave Database? Can you directly change the order when querying?
Is there a way to sort 100 records from the database?
Slave Database? Can you directly change the order when querying?
The last two fields are the result of indirect query from another table and then appended with an array, which leads to the current location problem.
1. do not simply select *Instead, select id, username, mobile... is listed one by one, and the order you requested is not there.2
Basic JavaScript data types and types detection, javascript Data Types1. [basic JavaScript Data Types] JavaScript has dynamic types. This means that the same variables can be of different types."String" "number" "object" "boolean" "function" "undefined"Attribute:Str. length
Var str = "123, ABC, 900, rgy, rrrr"; console. log (str. length); // 20var str = "123, ABC, 900, ran Guangyu, rrrr"; console. log (str.
Ask a question about PHP destructor
========================Output results: 444,455,555,123,123======================
I would like to ask is that the destructor is not executed after the object is destroyed, when the object $rrrr execution, when the execution of $AAAA $rrrr This object should have been destroyed ah, this destruction should output the destructor "123" but we see the result is, 444,455,555,
######################################## ######################SQL Script: lists the historical changes of the space used by the objects in a snapshot:
Column owner format a16Column object_name format a36Column start_day format a11Column block_increase format 9999999999.
Select obj. owner, obj. object_name,To_char (sn. BEGIN_INTERVAL_TIME, 'rrrr-MON-DD ') start_day,Sum (a. db_block_changes_delta) block_increaseFrom dba_hist_seg_stat,Dba_hist_snapshot
Because of work requirements, you need to write a mysql custom number of rows, as shown below: DELIMITER $ DROPFUNCTIONIFEXISTS 'onlinefunction '$ CREATEFUNCTION 'onlinefunction' (rrrrVARCHAR (50) RETURNSVARCHAR (255) BEGINIF (rrrronline) THENRETURN goes live; ENDIF; END $ DELIMITER;
Because of work requirements, you need to write a mysql custom number of rows, as follows: DELIMITER $ drop function if exists 'onlinefunction '$ create function 'onlinefunction' (
permissions for the test library:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| Test |
+--------------------+
mysql> use test
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| tttt |
+----------------+
mysql> select * from TTTT; +------+
| id |
+------+
| 1 |
| |
+------+
mysql> insert INTO
Document with its own method:Loop execution: var Timeid = Window.setinterval ("Method name or method", "delay"); Window.clearinterval (Timeid);Timed execution: var tmid = Window.settimeout ("Method name or method", "delay"); Window.cleartimeout (Tmid);An example is provided:
SetTimeout and setinteval Their syntax is essentially the same, but the complete function is different.
The SetTimeout method is the timer program, which is what to do after the time. Just finish it.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.